package lhdx10;

import java.util.Scanner;

public class LeaseManagement {
    public static void main(String[] args) {
        CarRental C = new CarRental("金龙至尊租赁有限公司", "99999999");
        // Automobile au=new()
        Scanner in = new Scanner(System.in);
        int j = 0;
        while (true) {
            C.xinX();
            System.out.println("1.采购新车，2.查看车辆信息，3租赁车辆，4.还车，5.报废，6.收入，7.出租记录，9.退出");
            j = in.nextInt();
            if (j == 1) {
                int j1 = 0;
                System.out.println("新车类型：1.轿车，2.客车");
                j1 = in.nextInt();
                while (true) {
                    if (j1 == 1) {
                        Limousine A = new Limousine();
                        A.setType("轿车");
                        System.out.println("新车品牌");
                        A.setBrand(in.next());
                        System.out.println("车牌号");
                        A.setPlateNumber(in.next());
                        System.out.println("日租金");
                        A.setDailyRent(in.nextInt());
                        System.out.println("座位数");
                        A.setSeat(in.nextInt());
                        C.purchase(A);
                        break;
                    }
                    if (j1 == 2) {
                        PassengerCar A = new PassengerCar();
                        A.setType("客车");
                        System.out.println("新车品牌");
                        A.setBrand(in.next());
                        System.out.println("车牌号");
                        A.setPlateNumber(in.next());
                        System.out.println("日租金");
                        A.setDailyRent(in.nextInt());
                        System.out.println("座位数");
                        A.setSeat(in.nextInt());
                        C.purchase(A);
                        break;
                    }
                    System.out.println("输入错误！");
                    j1 = in.nextInt();
                }
            } else if (j == 2) {
                C.message();
            } else if (j == 3) {
                System.out.print("请输入要租赁的类型(轿车/客车)");
                String type = in.next();
                int j2 = C.zuLin1(type);
                if (j2 == 0) {
                    System.out.println("无法出租！");
                    continue;
                }
                System.out.print("请输入您要租赁的车辆的车牌号：");
                String plateNumber = in.next();
                Automobile c = C.zuLin(plateNumber);
                if (c == null) {
                    System.out.println(" ");
                    continue;
                }
                System.out.print("请输入租赁的天数：");
                int a1 = in.nextInt();
                System.out.println("请输入姓名和手机号");
                String name = in.next();
                String phone = in.next();
                C.zuLin2(type, plateNumber, a1);
                C.add(name, phone, plateNumber, a1);
            } else if (j == 4) {
                System.out.print("请输入车牌号：");
                String plateNumber = in.next();
                C.haiChe(plateNumber);
            } else if (j == 5) {
                System.out.print("请输入报废车辆的车牌号：");
                String plateNumber = in.next();
                C.baoFei(plateNumber);
            } else if (j == 6) {
                C.shouRu();
            } else if (j == 7) {
                C.chaJiLi();
            } else if (j == 9) {
                System.out.println("欢迎下次光临！");
                break;
            }
        }
    }
}
